package com.banshou.installs.constant;

import android.app.Activity;
import android.app.Application;
import android.content.Context;

import com.blankj.utilcode.util.Utils;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by cjq on 2018/1/2.
 * Email: stoic_yb@139.com
 * features:
 */

public class BaseApplication extends Application {
    private static Context context;

    public static List<Activity> activityList = new ArrayList<>();

    public static void AddActivity(Activity activity) {
        activityList.add(activity);
    }

    public static void exit() {
        for (Activity activity : activityList) {
            activity.finish();
        }
        activityList.clear();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Utils.init(this);
        //logger初始化
        Logger.addLogAdapter(new AndroidLogAdapter());
        context = this;
    }

    public static Context getContext() {
        return context;
    }
}
